# utf-8

"""
solution for fib

f(n) = f(n-1) + f(n-2)


f(0) = 1
f(1) = 1
f(2) = 2
f(3) = 3
f(4) = 5
f(5) = 8


...

f(5) =

"""

# print("hello")

def fib(n):
    """input a number and calc the result of fib method.
    input: an integer number
    return: a result
    """
    if n < 2:
        return 1

    i = 0
    
    pre = 1
    aft = 1
    tmp = 0

    while(i <n):
        # print("i=%d,pre=%d,aft=%d"%(i, pre,aft))
        tmp = aft
        aft = pre + aft
        pre = tmp
        i = i + 1
    
    return pre

res = fib(5)
print("res:", res)
